package com.shenma2009.controller;

import com.shenma2009.domain.ResultResponse;
import com.shenma2009.service.TbSecKillService;
import com.shenma2009.vo.IdVo;
import com.shenma2009.vo.KillVo;
import com.shenma2009.vo.PageVo;
import com.shenma2009.vo.TbSecKillVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 军哥
 * @version 1.0
 * @description: TbSecKillController
 * @date 2023/5/4 15:05
 */

@RequestMapping(value = "/kill")
@RestController
@Slf4j
public class TbSecKillController {

    @Autowired
    TbSecKillService tbSecKillService;

    /**
     * @description 添加秒杀活动
     * @author 军哥
     * @date 2023/5/4 15:09
     * @version 1.0
     */
    @PostMapping(value = "/add")
    public ResultResponse add(@RequestBody TbSecKillVo tbSecKillVo) {
        return tbSecKillService.add(tbSecKillVo);
    }

    @PostMapping(value = "/list")
    public ResultResponse list(@RequestBody PageVo pageVo) {
        return tbSecKillService.listByPage(pageVo);
    }

    @PostMapping(value = "/startKill")
    public ResultResponse startKill(@RequestBody IdVo idVo) {
        return tbSecKillService.startKill(idVo);
    }

    @PostMapping(value = "/doKill")
    public ResultResponse doKill(@RequestBody KillVo killVo) {
        return tbSecKillService.doKill(killVo);
    }

    @PostMapping(value = "/getKill")
    public ResultResponse getKill(@RequestBody KillVo killVo) {
        return tbSecKillService.getKill(killVo);
    }

}
